<template>
  <div class="content">
    <div class="header">
      <el-row type="flex">
        <el-row type="flex">
          <el-input
            v-model="queryList.keyword"
            size="small"
            clearable
            placeholder="ID/手机号/姓名"
          />
          <el-button
            class="searchBtn"
            size="small"
            type="primary"
            @click="handleSearch"
          >搜索</el-button>
          <el-button
            class="addTeachBtn"
            size="small"
            type="primary"
            @click="add_Teacher_List"
          >添加老师</el-button>
        </el-row>
      </el-row>
    </div>
    <!-- 封面列表 -->
    <el-table
      :data="list"
      :element-loading-text="g.loadingStr"
      :header-cell-style="{ background: g.mainColor }"
      border
      fit
      highlight-current-row
      style="width: 100%"
    >
      <el-table-column label="序号" align="center" width="100" fixed>
        <template slot-scope="{ $index }">
          <span>{{ $index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="ID" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.userId }}</span>
        </template>
      </el-table-column>
      <el-table-column label="老师头像" align="center">
        <template slot-scope="{ row }">
          <img
            v-if="row.avatar !== ''"
            :src="row.avatar"
            class="teacherHead"
            alt
          >
          <img
            v-else
            class="teacherHead"
            src="http://ossdev0.jiabala.com/bduHjrswEDdFO"
            alt
          >
        </template>
      </el-table-column>
      <el-table-column label="老师姓名" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.nickName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="手机号" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.phone }}</span>
        </template>
      </el-table-column>
      <el-table-column label="意向职位" align="center">
        <template slot-scope="{ row }">
          <span
            v-if="
              row.positionChildName !== null && row.positionChildName !== ''
            "
          >{{ row.positionChildName }}</span>
          <span v-else>{{ row.positionName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="授课方式" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.teacherModeName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="意向城市" align="center">
        <template slot-scope="{ row }">
          <p v-if="row.intentionProvinceName">
            <span
              v-if="row.intentionProvinceName.split(',')[0].length > 0"
            >{{ row.intentionProvinceName.split(",")[0] }}-{{
              row.intentionCityName.split(",")[0]
            }}
            </span>
            <br>
            <span
              v-if="row.intentionProvinceName.split(',')[1]"
            >{{ row.intentionProvinceName.split(",")[1] }}-{{
              row.intentionCityName.split(",")[1]
            }}
            </span>
            <br>
            <span
              v-if="row.intentionProvinceName.split(',')[2]"
            >{{ row.intentionProvinceName.split(",")[2] }}-{{
              row.intentionCityName.split(",")[2]
            }}</span>
          </p>
        </template>
      </el-table-column>
      <el-table-column label="工作性质" align="center">
        <template slot-scope="{ row }">
          <span>{{
            row.workNature == null ? "" : row.workNature === 1 ? "全职" : "兼职"
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="求职状态" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.jobWantedName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" min-width="200px">
        <template slot-scope="{ row, $index }">
          <el-button
            type="primary"
            size="mini"
            @click="check_Teacher_Resume_Detail(row)"
          >查看详情</el-button>
          <el-button
            type="warning"
            size="mini"
            @click="push_Teacher_Resume(row)"
          >推送</el-button>
          <el-button
            type="success"
            size="mini"
            @click="edit_Teacher_Resume(row)"
          >编辑</el-button>
          <el-button
            type="danger"
            size="mini"
            @click="delete_Teacher_Resume(row, $index)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <resumeInfoDetail
      ref="$resume"
      :is-show-dialog="teacherResumeInfoDialog"
      :user-id="userId"
      @closeDialog="closeRusemeDetail"
    />
    <!-- 添加老师 start -->
    <el-dialog
      :title="handleResume"
      :visible.sync="addTracherDialog"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      width="1500px"
      @close="$refs['form'].clearValidate()"
    >
      <el-form
        ref="form"
        :model="profile"
        :rules="profileRules"
        label-width="110px"
        class="addTeacherForm"
      >
        <div class="left">
          <label class="labelStyle">基本信息</label>
          <el-form-item label="头像">
            <el-upload
              :on-remove="remove_Upload_imageList"
              :on-change="add_Upload_imageList"
              :auto-upload="false"
              :class="{ hide: hideUpload }"
              :file-list="imgsList"
              action="#"
              list-type="picture-card"
            >
              <i class="el-icon-plus" />
            </el-upload>
          </el-form-item>
          <el-form-item label="姓名" prop="accountProfile.nickName">
            <el-input
              v-model="profile.accountProfile.nickName"
              placeholder="请输入姓名"
              clearable
            />
          </el-form-item>
          <el-form-item label="性别" prop="accountProfile.sex">
            <el-radio-group v-model="profile.accountProfile.sex">
              <el-radio label="1">男</el-radio>
              <el-radio label="2">女</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="出生日期">
            <el-date-picker
              v-model="profile.accountProfile.birthday"
              value-format="timestamp"
              type="date"
              placeholder="请选择出生日期"
            />
          </el-form-item>
          <el-form-item label="现居地址" class="chooseAddressNow">
            <el-select
              v-model="profile.accountProfile.liveAddressProvince"
              placeholder="省"
              @change="select_Live_Provice"
            >
              <el-option
                v-for="(item, index) in provinceList"
                :key="index"
                :label="item.provinceName"
                :value="item.provinceName"
              />
            </el-select>
            <el-select
              v-model="profile.accountProfile.liveAddressCity"
              placeholder="市"
              @change="select_Live_City"
            >
              <el-option
                v-for="(item, index) in liveCityList"
                :key="index"
                :label="item.cityName"
                :value="item.cityName"
              />
            </el-select>
            <el-select
              v-model="profile.accountProfile.liveAddressRegion"
              placeholder="区"
              @change="select_Live_Region"
            >
              <el-option
                v-for="(item, index) in areaList"
                :key="index"
                :label="item.areaName"
                :value="item.areaName"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="参加工作时间" prop="accountProfile.joinWorkTime">
            <el-date-picker
              v-model="profile.accountProfile.joinWorkTime"
              value-format="timestamp"
              type="date"
              placeholder="参加工作时间"
            />
          </el-form-item>
          <el-form-item label="学历">
            <el-select
              v-model="profile.accountProfile.educationId"
              placeholder="请选择学历"
              @change="select_Education"
            >
              <el-option
                v-for="(item, index) in educationList"
                :key="index"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="证书">
            <el-select
              v-model="profile.accountProfile.certificateStatus"
              placeholder="请选择授课方式"
            >
              <el-option label="教师资格证" value="1" />
              <el-option label="教师资格证考取中" value="2" />
              <el-option label="无教师资格证" value="3" />
            </el-select>
          </el-form-item>
          <el-form-item
            class="xrequired"
            label="联系手机号"
            prop="accountProfile.phone"
          >
            <el-input
              v-model="profile.accountProfile.phone"
              placeholder="请输入联系手机号"
              clearable
            />
          </el-form-item>
          <el-form-item label="是否公开简历">
            <el-switch v-model="isPublic" @change="is_Open_Resume" />
          </el-form-item>
          <el-form-item label="屏蔽公司">
            <el-tag
              v-for="(tag, index) in blackCompanyList"
              :key="tag"
              :disable-transitions="false"
              closable
              @close="removeBlackCompany(index)"
            >{{ tag }}</el-tag>
            <el-autocomplete
              v-model="shieldCompanyName"
              :fetch-suggestions="querySearch"
              :trigger-on-focus="false"
              class="inline-input"
              placeholder="请输入内容"
              @select="selectShieldCompany"
            />
            <el-button
              class="button_new_tag"
              size="small"
              @click="comfirm_Shield_Company"
            >+屏蔽该公司</el-button>
          </el-form-item>
          <label class="labelStyle">教育经历</label>
          <el-button
            class="addBtn"
            size="mini"
            type="success"
            @click="add_Education_Experience"
          >添加教育经历</el-button>
          <div class="showExpre">
            <div v-for="(item, index) in profile.experiences" :key="index">
              <h3>
                <p>{{ item.schoolName }}</p>
                <el-button
                  class="editBtn"
                  type="primary"
                  size="mini"
                  icon="el-icon-edit"
                  circle
                  @click="edit_Education_Experience(item, index)"
                />
                <el-button
                  class="editBtn"
                  type="danger"
                  size="mini"
                  icon="el-icon-delete"
                  circle
                  @click="delete_Education_Experience(index)"
                />
              </h3>
              <span>{{ item.admissionTime | parseTime("{y}-{m}") }}~{{
                item.graduationTime | parseTime("{y}-{m}")
              }}</span>
              <p>
                <span>{{ item.educationName }}</span>
                <span>{{ item.majorName }}</span>
                <span>{{ item.majorType == "1" ? "师范" : "非师范" }}</span>
                <span>{{
                  item.isFullTime == "1" ? "全日制" : "非全日制"
                }}</span>
              </p>
            </div>
          </div>
          <div />
          <label class="labelStyle">工作经历</label>
          <el-button
            class="addBtn"
            size="mini"
            type="success"
            @click="add_Works_Experience"
          >添加工作经历</el-button>
          <div class="showExpre">
            <div v-for="(item, index) in profile.works" :key="index">
              <h3>
                <p>{{ item.businessName }}</p>
                <el-button
                  class="editBtn"
                  type="primary"
                  size="mini"
                  icon="el-icon-edit"
                  circle
                  @click="edit_Works_Experience(item, index)"
                />
                <el-button
                  class="editBtn"
                  type="danger"
                  size="mini"
                  icon="el-icon-delete"
                  circle
                  @click="delete_Works_Experience(index)"
                />
              </h3>
              <span>{{ item.entryTime | parseTime("{y}-{m}") }}~{{
                item.quitTime | parseTime("{y}-{m}")
              }}</span>
              <p class="retrun_html" v-html="item.workDescribe" />
            </div>
          </div>
        </div>
        <div class="right">
          <label class="labelStyle">求职意向</label>
          <el-form-item label="职位意向">
            <el-cascader
              v-model="value"
              :options="options"
              style="width: 320px"
              @change="select_Jobs_Intention"
            />
          </el-form-item>
          <el-form-item label="职位层级" prop="jobIntention.hierarchyId">
            <el-select
              v-model="profile.jobIntention.hierarchyId"
              placeholder="请选择职位层级"
              @change="chooseLevel"
            >
              <el-option
                v-for="(item, index) in levelList"
                :key="index"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="授课方式" prop="jobIntention.teacherModeId">
            <el-select
              v-model="profile.jobIntention.teacherModeId"
              placeholder="请选择授课方式"
              @change="chooseMode"
            >
              <el-option
                v-for="(item, index) in teacherModeList"
                :key="index"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="意向城市">
            <div>
              <el-tag
                v-for="(tag, index) in intention_City_Tags"
                :key="tag"
                :disable-transitions="false"
                closable
                @close="remove_Intention_City(tag, index)"
              >{{ tag }}</el-tag>
            </div>
            <div class="chooseCity">
              <el-select
                v-model="profile.jobIntention.intentionProvinceCode"
                placeholder="意向省份"
                @change="handleProvice"
              >
                <el-option
                  v-for="(item, index) in provinceList"
                  :key="index"
                  :label="item.provinceName"
                  :value="item.provinceCode"
                />
              </el-select>
              <el-select
                v-model="profile.jobIntention.intentionCityCode"
                placeholder="意向市区"
                @change="handleCity"
              >
                <el-option
                  v-for="(item, index) in cityList"
                  :key="index"
                  :label="item.cityName"
                  :value="item.cityCode"
                />
              </el-select>
              <el-button
                class="button_new_tag"
                size="small"
                @click="add_Intention_Work_Citys"
              >+添加城市</el-button>
            </div>
          </el-form-item>
          <el-form-item label="期望薪资">
            <div class="salary">
              <el-select
                v-model="profile.jobIntention.salaryMin"
                placeholder="最低薪资"
                @change="select_Salary"
              >
                <el-option
                  v-for="(item, index) in salaryMinList"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
              <span>至</span>
              <el-select
                v-model="profile.jobIntention.salaryMax"
                placeholder="最高薪资"
              >
                <el-option
                  v-for="(item, index) in salaryMaxList"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </div>
          </el-form-item>
          <el-form-item label="工作性质" prop="jobIntention.workNature">
            <el-select
              v-model="profile.jobIntention.workNature"
              placeholder="请选择工作性质"
            >
              <el-option label="全职" value="1" />
              <el-option label="兼职" value="2" />
            </el-select>
          </el-form-item>
          <el-form-item label="求职状态">
            <el-select
              v-model="profile.jobIntention.jobWantedStatusId"
              placeholder="请选择求职状态"
              @change="chooseJobStatus"
            >
              <el-option
                v-for="(item, index) in jobStatusList"
                :key="index"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="到岗时间">
            <el-select
              v-model="profile.jobIntention.startTimeId"
              placeholder="请选择到岗时间"
              @change="chooseArrTimeName"
            >
              <el-option
                v-for="(item, index) in arrTimeList"
                :key="index"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="期望福利">
            <el-checkbox-group
              v-model="welfarTypeName"
              @change="chooseWelfarName"
            >
              <el-checkbox
                v-for="(item, index) in WelfareList"
                :key="index"
                :label="item.name"
                :name="item.id"
              />
            </el-checkbox-group>
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="addTracherDialog = false">取 消</el-button>
        <el-button type="primary" @click="submit('form')">提交</el-button>
      </div>
    </el-dialog>
    <!-- 添加老师 end -->
    <!-- 添加教育经历 start -->
    <el-dialog
      :title="education_Title"
      :visible.sync="addEducationExperienceDialog"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      width="600px"
      append-to-body
    >
      <el-form
        ref="EducationExperience"
        :model="EducationExperience"
        :rules="educationRules"
        label-width="110px"
        class="addTeacherForm"
      >
        <el-form-item label="学校名字" prop="schoolName">
          <el-input
            v-model="EducationExperience.schoolName"
            placeholder="请输入学校名字"
            clearable
          />
        </el-form-item>
        <el-form-item label="学历" prop="educationId">
          <el-select
            v-model="EducationExperience.educationId"
            placeholder="请选择学历"
            @change="chooseEducationExp"
          >
            <el-option
              v-for="(item, index) in educationList"
              :key="index"
              :label="item.name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="入学时间" prop="admissionTime">
          <el-date-picker
            v-model="EducationExperience.admissionTime"
            value-format="timestamp"
            type="month"
            placeholder="入学时间"
          />
        </el-form-item>
        <el-form-item label="毕业时间" prop="graduationTime">
          <el-date-picker
            v-model="EducationExperience.graduationTime"
            value-format="timestamp"
            type="month"
            placeholder="毕业时间"
          />
        </el-form-item>
        <el-form-item label="专业名称" prop="majorName">
          <el-input
            v-model="EducationExperience.majorName"
            placeholder="请选择专业名称"
            clearable
          />
        </el-form-item>
        <el-form-item label="专业类型" prop="majorType">
          <el-radio-group v-model="EducationExperience.majorType">
            <el-radio label="1">师范</el-radio>
            <el-radio label="2">非师范</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="是否全日制" prop="isFullTime">
          <el-radio-group v-model="EducationExperience.isFullTime">
            <el-radio label="1">全日制</el-radio>
            <el-radio label="0">非全日制</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          @click="addEducationExperienceDialog = false"
        >取 消</el-button>
        <el-button
          type="primary"
          @click="EducationExperienceSubmit('EducationExperience')"
        >保存</el-button>
      </div>
    </el-dialog>
    <!-- 添加教育经历 end -->
    <!-- 添加工作经历 start -->
    <el-dialog
      :title="work_Title"
      :visible.sync="addWorkExperienceDialog"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      min-width="1000px"
      append-to-body
    >
      <el-form
        ref="WorkExperience"
        :model="WorkExperience"
        :rules="woekRules"
        label-width="110px"
        class="addTeacherForm"
      >
        <el-form-item label="单位名称" prop="businessName">
          <el-input
            v-model="WorkExperience.businessName"
            placeholder="请输入单位名称"
            clearable
          />
        </el-form-item>
        <el-form-item label="入职时间" prop="entryTime">
          <el-date-picker
            v-model="WorkExperience.entryTime"
            value-format="timestamp"
            type="month"
            placeholder="入职时间"
          />
        </el-form-item>
        <el-form-item label="离职时间" prop="quitTime">
          <el-date-picker
            v-model="WorkExperience.quitTime"
            value-format="timestamp"
            type="month"
            placeholder="离职时间"
          />
        </el-form-item>
        <el-form-item label="从事职位">
          <el-input
            v-model="WorkExperience.positionName"
            placeholder="请输入从事职位"
            clearable
          />
        </el-form-item>
        <el-form-item label="工作描述">
          <el-input v-model="WorkExperience.workDescribe" type="textarea" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="addWorkExperienceDialog = false">取 消</el-button>
        <el-button
          type="primary"
          @click="WorkExperienceSubmit('WorkExperience')"
        >保存</el-button>
      </div>
    </el-dialog>
    <!-- 推送服务 -->
    <el-dialog :visible.sync="pushServiceDialog" append-to-body width="1300px">
      <div class="headerForm">
        <el-input
          v-model="orgPositionsList.keyword"
          clearable
          placeholder="机构名称"
        />
        <el-button
          class="searchBtn"
          type="primary"
          @click="getOrgPositionsList()"
        >搜索</el-button>
      </div>
      <el-table
        :data="organizationDataList"
        :element-loading-text="g.loadingStr"
        :header-cell-style="{ background: g.mainColor }"
        border
        fit
        highlight-current-row
        height="500"
        style="width: 100%"
      >
        <el-table-column label="机构logo" align="center">
          <template slot-scope="{ row }">
            <img :src="row.businessLogo" class="organizationImgInfo" alt>
          </template>
        </el-table-column>
        <el-table-column label="机构名称" align="center">
          <template slot-scope="{ row }">
            <span style="font-weight: 700; font-size: 18px">{{
              row.businessName
            }}</span>
          </template>
        </el-table-column>
        <el-table-column label="招聘职位" align="center">
          <template slot-scope="{ row }">
            <span style="font-weight: 700; font-size: 18px">{{
              row.positionName
            }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="{ row }">
            <el-button
              type="primary"
              :disabled="row.isRecommend === 0"
              @click="sentResumeToOrg(row)"
            >{{ row.isRecommend === 0 ? "已推送" : "推送" }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <pagination
          v-show="orgTotalNum > 0"
          :total="orgTotalNum"
          :page.sync="orgPositionsList.currentPage"
          :limit.sync="orgPositionsList.pageSize"
          @pagination="getOrgPositionsList()"
        />
      </div>
    </el-dialog>
    <!-- 简历列表分页 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryList.currentPage"
      :limit.sync="queryList.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import * as power from '@/api/recruitment'
import Pagination from '@/components/Pagination'
import mixinOptions from '@/views/recruitment/power/getListOptions'
import resumeInfoDetail from '@/components/resumeInfo/resumeInfo'
export default {
  name: 'PowerList',
  components: { Pagination, resumeInfoDetail },
  mixins: [mixinOptions],
  data() {
    var checkTeacherPhone = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入手机号'))
      } else {
        if (!/^1[3456789]\d{9}$/.test(value)) {
          callback(new Error('请输入正确的手机号码'))
          return
        }
        this.checkTeacher(value).then((response) => {
          if (response) {
            callback(new Error('老师已经存在,请勿重复添加'))
          } else {
            callback()
          }
        })
      }
    }
    return {
      queryList: {
        keyword: '',
        currentPage: 1,
        pageSize: 10
      },
      list: [],
      total: 0,
      teacherResumeInfoDialog: false,
      addTracherDialog: false,
      addEducationExperienceDialog: false, // 添加教育经历模态框
      addWorkExperienceDialog: false, // 添加工作经历模态框
      handleResume: '添加老师',
      profile: {
        accountProfile: {
          avatar: '',
          nickName: '',
          sex: '',
          birthday: '',
          liveAddressProvince: '', // 省
          liveAddressCity: '', // 市
          liveAddressRegion: '', // 区
          liveAddressCode: '', // 省市区code string
          educationId: '', // 学历编号
          educationName: '', // 学历名称
          isPublic: '1', // 是否公开
          joinWorkTime: '', // 参加工作时间
          certificateStatus: '', // 证书
          phone: ''
        },
        experiences: [],
        works: [],
        jobIntention: {
          isRange: '', // 是否学科辅导
          positionId: '', // 职位编号
          positionName: '', // 职位名称
          positionChildId: '', // 子职位编号
          positionChildName: '', // 子职位名称
          hierarchyId: '', // 层级编号
          hierarchyName: '', // 层级名称
          teacherModeId: '', // 授课方式
          teacherModeName: '', // 授课名称
          intentionProvinceCode: '', // 省编号
          intentionProvinceName: '', // 省名称
          intentionCityCode: '', // 市编号
          intentionCityName: '', // 市名称
          salaryMin: '', // 最小薪资
          salaryMax: '', // 最高薪资
          workNature: '', // 工作性质
          jobWantedStatusId: '', // 求职状态
          jobWantedName: '', // 求职状态名字
          startTimeId: '', // 到岗时间编号
          startTimeName: '', // 到岗时间名
          welfareIds: '', // 福利编号
          welfareNames: '' // 福利名集合
        },
        shields: []
      },
      isPublic: true, // 是否公开
      provinceCode: '', // 省code
      cityCode: '', // 市code
      areaCode: '', // 区code
      welfarIdName: [], // 福利id集合
      welfarTypeName: [], // 福利名字集合
      proviceCity: '',
      intention_City_Tags: [], // 意向城市数组
      teacherInfo: {}, // 查看老师详情信息
      copyEductionExpe: {}, // 拷贝教育经历
      EducationExperienceArray: [], // 教育经历数组
      EducationExperience: {
        schoolName: '', // 毕业学校
        educationId: '', // 学历
        educationName: '', // 学历名字
        admissionTime: '', // 入学时间
        graduationTime: '', // 毕业时间
        majorName: '', // 专业
        majorType: '', // 专业类型
        isFullTime: '' // 全日制
      },
      copyWorkExpe: {}, // 拷贝工作经历
      WorkExperienceArray: [], // 工作经历数组
      WorkExperience: {
        businessName: '', // 单位名字
        entryTime: '',
        quitTime: '',
        positionName: '', // 从事职位
        workDescribe: '' // 描述
      },
      imgsList: [], // 图片信息
      imgFile: {}, // 图片文件
      hideUpload: false,
      salaryMaxList: [],
      profileRules: {
        'accountProfile.nickName': [
          { required: true, message: '请输入姓名', trigger: 'change' }
        ],
        'accountProfile.sex': [
          { required: true, message: '请选择性别', trigger: 'change' }
        ],
        'accountProfile.phone': [
          { validator: checkTeacherPhone, trigger: 'blur' }
        ],
        'accountProfile.joinWorkTime': [
          { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
        ],
        'jobIntention.positionName': [
          { type: 'array', required: true, message: '请输入职位意向', trigger: 'change' }
        ],
        'jobIntention.positionId': [
          { required: true, message: '请输入职位意向', trigger: 'change' }
        ],
        'jobIntention.hierarchyId': [
          { required: true, message: '请选择职位层级', trigger: 'change' }
        ],
        'jobIntention.teacherModeId': [
          { required: true, message: '请选择授课方式', trigger: 'change' }
        ],
        'jobIntention.workNature': [
          { required: true, message: '请选择工作性质', trigger: 'change' }
        ]
      },
      woekRules: {
        businessName: [
          { required: true, message: '请输入单位名称', trigger: 'blur' }
        ],
        entryTime: [
          { required: true, message: '请选择入职时间', trigger: 'change' }
        ],
        quitTime: [
          { required: true, message: '请选择毕业时间', trigger: 'change' }
        ]
      },
      educationRules: {
        admissionTime: [
          { required: true, message: '请选择入学时间', trigger: 'change' }
        ],
        graduationTime: [
          { required: true, message: '请选择毕业时间', trigger: 'change' }
        ],
        schoolName: [
          { required: true, message: '请输入学校名称', trigger: 'blur' }
        ],
        educationId: [
          { required: true, message: '请选择职位层级', trigger: 'change' }
        ],
        majorName: [
          { required: true, message: '请选择专业名称', trigger: 'change' }
        ],
        majorType: [
          { required: true, message: '请选择专业类型', trigger: 'change' }
        ],
        isFullTime: [
          { required: true, message: '是否全日制', trigger: 'change' }
        ]
      },
      accountProfileDetail: {}, // 老师信息
      experiences: [], // 教育经历
      works: [], // 工作经历
      jobIntention: {}, // 意向信息
      age: '', // 年龄
      joinTime: '', // 工作年限
      restaurants: [],
      work_Title: '添加工作经历',
      education_Title: '添加教育经历',
      shieldCompanyName: '', // 屏蔽公司
      saveCompany: [],
      blackCompanyList: [], // 屏蔽公司列表
      alreadyChooseCity: [],
      eduIndex: null,
      workIndex: null,
      interestList: [], // 兴趣教育列表
      subjectList: [], // 学科辅导列表
      copy_Education_Experience: {},
      copyWorkObj: {},
      totalProvienceName: '',
      totalCityName: '',
      totalProvienceCode: '',
      totalCityCode: '',
      value: [],
      options: [
        { value: 2, label: '学科辅导', children: [] },
        { value: 1, label: '兴趣教育', children: [] },
        { value: 3, label: '职业顾问' }
      ],
      intention_city_string: '',
      accountProfileId: '',
      jobIntentionId: '',
      worksId: '',
      expId: '',
      delExperrience: [],
      delWorks: [],
      editProvice: '',
      editCity: '',
      editProviceCode: '',
      editCityCode: '',
      returnWorksArr: [],
      // 推送
      pushServiceDialog: false,
      organizationDataList: [],
      orgTotalNum: 1,
      userId: '',
      orgPositionsList: {
        keyword: '',
        currentPage: 1,
        pageSize: 10
      },
      // 用户资料编号id
      userProfileId: ''
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    closeRusemeDetail(val) {
      this.teacherResumeInfoDialog = val
    },
    // 推送入口
    push_Teacher_Resume(row) {
      this.userProfileId = row.id
      this.orgPositionsList.keyword = row.positionChildName || row.positionName
      this.pushServiceDialog = true
      this.getOrgPositionsList()
    },
    // 查询机构的所有相关职位
    getOrgPositionsList() {
      power.getOrgWithId(this.orgPositionsList).then(res => {
        this.organizationDataList = res.data.records
        this.orgTotalNum = res.data.total
      })
    },
    // 推送简历给机构
    sentResumeToOrg(row) {
      const sentQuerys = {
        businessId: row.businessId,
        businessName: row.businessName,
        businessLogo: row.businessLogo,
        status: row.status,
        isDel: row.isDel,
        positionInfoId: row.positionChildId || row.positionId,
        positionInfoName: row.positionChildName || row.positionName,
        userProfileId: this.userProfileId,
        receiverId: row.createBy
      }
      power.addRecommend(sentQuerys).then(res => {
        if (res.code === '200') {
          this.$message.success('推送成功')
        }
      })
    },
    // 搜索功能
    handleSearch() {
      this.queryList.currentPage = 1
      this.getList()
    },
    // 删除老师简历
    delete_Teacher_Resume(row, index) {
      this.$confirm(`此操作将永久删除该老师简历,是否继续?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          power.deleteTeacherResume({ id: row.id }).then((res) => {
            if (res.code === '200') {
              this.list.splice(index, 1)
              this.queryList.currentPage = 1
              this.getList()
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            }
          })
        })
        .catch(() => { })
    },
    // 编辑老师简历
    edit_Teacher_Resume(row) {
      this.addTracherDialog = true
      this.shieldCompanyName = ''
      this.handleResume = '编辑老师'
      this.getJobStatus()
      this.get_Level_List()
      this.checkTeacherMode()
      this.get_Welfare_List()
      this.getEducationList()
      this.get_Province_List()
      this.get_Arrive_Time_List()
      this.getSubjectPositionList()
      this.getIntentionTotalPositionList()
      power.getTeacherInfo({ id: row.userId, type: '' }).then((res) => {
        const info = res.data
        console.log(info)
        this.accountProfileId = info.accountProfile.id
        if (info.jobIntention) {
          this.jobIntentionId = info.jobIntention.id
          this.profile.jobIntention = info.jobIntention
          this.profile.jobIntention.workNature = info.jobIntention.workNature + ''
          this.editCity = info.jobIntention.intentionCityName
          this.editCityCode = info.jobIntention.intentionCityCode
          this.editProvice = info.jobIntention.intentionProvinceName
          this.editProviceCode = info.jobIntention.intentionProvinceCode
          this.welfarTypeName = info.jobIntention.welfareNames === '' ? [] : info.jobIntention.welfareNames.split(',')
          const province = info.jobIntention.intentionProvinceName.split(',')
          const city = info.jobIntention.intentionCityName.split(',')
          this.intention_City_Tags = []
          if (province[0].length === 0) {
            province.shift()
            city.shift()
          }
          province.forEach((item, index) => {
            this.intention_City_Tags.push(province[index] + city[index])
          })
          if (info.jobIntention.salaryMin) {
            let _index = -1
            this.salaryMinList.forEach((item, index) => {
              if (item.value === info.jobIntention.salaryMax) {
                _index = index
              }
            })
            this.salaryMaxList = this.salaryMinList.slice(_index + 1, this.salaryMinList.length)
            this.profile.jobIntention.salaryMax = this.salaryMinList[_index].label
          }
          switch (info.jobIntention.isRange) {
            case 2:
              this.value = [info.jobIntention.isRange, JSON.stringify({ id: info.jobIntention.positionId, name: info.jobIntention.positionName })]
              break
            case 1:
              this.value = [info.jobIntention.isRange, JSON.stringify({ id: info.jobIntention.positionId, name: info.jobIntention.positionName }), JSON.stringify({ id: info.jobIntention.positionChildId, name: info.jobIntention.positionChildName })]
              break
            default:
              this.value = [info.jobIntention.isRange]
          }
        }
        this.hideUpload = Boolean(info.accountProfile.avatar)
        this.imgsList = info.accountProfile.avatar ? [{ url: info.accountProfile.avatar }] : [{ url: 'http://ossdev0.jiabala.com/bduHjrswEDdFO' }]
        this.returnWorksArr = []
        this.profile.works = info.works
        if (info.works.length > 0) {
          this.profile.works.forEach((item) => {
            item.workDescribe = item.workDescribe.replace(/\n/g, '<br />')
          })
        }
        this.profile.experiences = info.experiences
        this.profile.accountProfile = {
          avatar: info.accountProfile.avatar,
          nickName: info.accountProfile.nickName,
          birthday: info.accountProfile.birthday,
          sex: info.accountProfile.sex + '',
          liveAddressProvince: info.accountProfile.liveAddressProvince,
          liveAddressCity: info.accountProfile.liveAddressCity,
          liveAddressRegion: info.accountProfile.liveAddressRegion,
          liveAddressCode: info.accountProfile.liveAddressCode,
          educationId: info.accountProfile.educationName + '',
          educationName: info.accountProfile.educationName,
          isPublic: info.accountProfile.isPublic,
          joinWorkTime: info.accountProfile.joinWorkTime,
          certificateStatus: info.accountProfile.certificateStatus == null ? '' : info.accountProfile.certificateStatus + '',
          phone: info.accountProfile.phone
        }
        this.delExperrience = []
        this.delWorks = []
        this.isPublic = info.accountProfile.isPublic !== 0
        this.profile.shields = info.shields.length > 0 ? info.shields : []
        this.delExperrience = JSON.parse(JSON.stringify(info.experiences))
        this.delWorks = JSON.parse(JSON.stringify(info.works))
        this.blackCompanyList = info.shields.map((item) => {
          return item.businessName
        })
        this.profile.jobIntention.intentionProvinceCode = ''
        this.profile.jobIntention.intentionProvinceName = ''
        this.profile.jobIntention.intentionCityCode = ''
        this.profile.jobIntention.intentionCityName = ''
      })
    },
    // 提交
    submit(formName) {
      if (this.handleResume === '添加老师') {
        this.$refs[formName].validate(async(valid) => {
          if (valid) {
            const config = this.profile
            config.jobIntention.intentionProvinceName = this.totalProvienceName.substr(0, this.totalProvienceName.length - 1)
            config.jobIntention.intentionProvinceCode = this.totalProvienceCode.substr(0, this.totalProvienceCode.length - 1)
            config.jobIntention.intentionCityName = this.totalCityName.substr(0, this.totalCityName.length - 1)
            config.jobIntention.intentionCityCode = this.totalCityCode.substr(0, this.totalCityCode.length - 1)
            const response = await power.submitTeacher(config)
            if (response.code === '200') {
              this.$message.success('添加成功')
              this.addTracherDialog = false
              this.queryList.currentPage = 1
              this.getList()
              this.$refs[formName].resetFields()
              this.imgsList = []
              this.hideUpload = false
              this.profile.shields = []
              this.blackCompanyList = []
            }
          } else {
            console.log('error submit!!')
            return false
          }
        })
      } else {
        this.profile.experiences = this.delExperrience
        this.profile.works = this.delWorks
        console.log(this.profile.shields)
        if (this.profile.jobIntention.salaryMin !== '' && this.profile.jobIntention.salaryMax === '') return this.$message.error('请选择最大薪资')
        this.salaryMinList.forEach((item) => {
          if (item.label === this.profile.jobIntention.salaryMax) {
            this.profile.jobIntention.salaryMax = item.value
          }
        })
        this.educationList.forEach((item) => {
          if (item.name === this.profile.accountProfile.educationId) {
            this.profile.accountProfile.educationId = item.id
          }
        })
        this.profile.jobIntention.id = this.jobIntentionId
        this.profile.accountProfile.id = this.accountProfileId
        const config = this.profile
        config.jobIntention.intentionProvinceName = this.editProvice
        config.jobIntention.intentionProvinceCode = this.editProviceCode
        config.jobIntention.intentionCityName = this.editCity
        config.jobIntention.intentionCityCode = this.editCityCode
        power.editTeacherResume(config).then((res) => {
          this.$message.success('编辑成功')
          this.addTracherDialog = false
          this.queryList.currentPage = 1
          this.getList()
          this.$refs[formName].resetFields()
        })
      }
    },
    // 添加城市
    add_Intention_Work_Citys() {
      if (this.profile.jobIntention.intentionProvinceName === '') return this.$message.error('请选择城市')
      if (this.profile.jobIntention.intentionCityName === '') return this.$message.error('请选择省份')
      if (this.alreadyChooseCity.length >= 3) return this.$message.error('最多选择三个城市')
      if (this.intention_City_Tags.length >= 3) return this.$message.error('最多选择三个城市')
      if (this.handleResume === '添加老师') {
        this.totalProvienceName +=
          this.profile.jobIntention.intentionProvinceName + ','
        this.totalProvienceCode +=
          this.profile.jobIntention.intentionProvinceCode + ','
        this.totalCityName += this.profile.jobIntention.intentionCityName + ','
        this.totalCityCode += this.profile.jobIntention.intentionCityCode + ','
        this.proviceCity =
          this.profile.jobIntention.intentionProvinceName +
          this.profile.jobIntention.intentionCityName
        this.alreadyChooseCity.push(this.proviceCity)
        this.alreadyChooseCity = [...new Set(this.alreadyChooseCity)]
        this.intention_City_Tags =
          this.alreadyChooseCity.length !== 0
            ? [...new Set(this.alreadyChooseCity)]
            : this.alreadyChooseCity
      } else {
        this.editProvice +=
          ',' + this.profile.jobIntention.intentionProvinceName
        this.editProviceCode +=
          ',' + this.profile.jobIntention.intentionProvinceCode
        this.editCity += ',' + this.profile.jobIntention.intentionCityName
        this.editCityCode += ',' + this.profile.jobIntention.intentionCityCode
        this.proviceCity =
          this.profile.jobIntention.intentionProvinceName +
          this.profile.jobIntention.intentionCityName
        this.alreadyChooseCity.push(this.proviceCity)
        this.alreadyChooseCity = [...new Set(this.alreadyChooseCity)]
        this.alreadyChooseCity =
          this.alreadyChooseCity.length !== 0
            ? [...new Set(this.alreadyChooseCity)]
            : this.alreadyChooseCity
        const arr = this.alreadyChooseCity.concat(this.intention_City_Tags)
        this.intention_City_Tags = [...new Set(arr)]
        this.profile.jobIntention.intentionProvinceCode = ''
        this.profile.jobIntention.intentionProvinceName = ''
        this.profile.jobIntention.intentionCityName = ''
        this.profile.jobIntention.intentionCityCode = ''
      }
    },
    // 删除意向城市
    remove_Intention_City(tag, index) {
      if (this.handleResume === '编辑老师') {
        this.intention_City_Tags.splice(index, 1)
        const province = this.editProvice.split(',')
        const city = this.editCity.split(',')
        const provinceCode = this.editProviceCode.split(',')
        const cityCode = this.editCityCode.split(',')
        const arr = []
        const newarr = []
        province.forEach((item, index) => {
          const obj = {
            name: province[index] + city[index],
            provice: province[index],
            provinceCode: provinceCode[index],
            city: city[index],
            cityCode: cityCode[index]
          }
          arr.push(obj)
        })
        if (arr.length > 0) {
          arr.forEach((item, key) => {
            this.intention_City_Tags.forEach((value) => {
              if (item.name === value) {
                newarr.push(item)
              }
            })
          })
        }
        const provinceNameList = []
        const provinceCodeList = []
        const cityNameList = []
        const cityCodeList = []
        newarr.forEach((item) => {
          provinceNameList.push(item.provice)
          provinceCodeList.push(item.provinceCode)
          cityNameList.push(item.city)
          cityCodeList.push(item.cityCode)
        })
        this.editProvice = provinceNameList.toString()
        this.editCity = cityNameList.toString()
        this.editProviceCode = provinceCodeList.toString()
        this.editCityCode = cityCodeList.toString()
      } else {
        this.intention_City_Tags.splice(
          this.intention_City_Tags.indexOf(tag),
          1
        )
      }
    },
    // 薪资
    select_Salary(e) {
      this.profile.jobIntention.salaryMax = ''
      if (e === 0) {
        this.salaryMaxList = [{ value: 0, label: '面议' }]
        this.profile.jobIntention.salaryMax = 0
      } else {
        let _index = -1
        this.salaryMinList.forEach((item, index) => {
          if (item.value === e) {
            _index = index
          }
        })
        this.salaryMaxList = this.salaryMinList.slice(
          _index + 1,
          this.salaryMinList.length
        )
      }
    },
    // 查询列表
    getList() {
      power.getTeacherList(this.queryList).then((res) => {
        const { total, records } = res.data
        this.list = records
        this.total = total
      })
    },
    // 查看详情
    check_Teacher_Resume_Detail(row) {
      this.teacherResumeInfoDialog = true
      this.userId = row.userId
      this.$refs.$resume.check_Teacher_Resume_Detail(row.userId)
    },
    // 添加老师
    add_Teacher_List() {
      this.profile.shields = []
      this.blackCompanyList = []
      for (const key in this.profile) {
        if (Array.isArray(this.profile[key])) {
          this.profile[key] = []
        } else {
          for (const value in this.profile[key]) {
            this.profile[key][value] = ''
          }
        }
      }
      this.saveCompany = []
      this.profile.shields = []
      this.hideUpload = false
      this.handleResume = '添加老师'
      this.imgsList = []
      this.value = []
      this.addTracherDialog = true
      this.isPublic = true
      this.welfarTypeName = []
      this.blackCompanyList = []
      this.alreadyChooseCity = []
      this.intention_City_Tags = []
      this.WorkExperienceArray = []
      this.EducationExperienceArray = []
      this.totalCityName = ''
      this.totalCityCode = ''
      this.shieldCompanyName = ''
      this.totalProvienceName = ''
      this.totalProvienceCode = ''
      this.profile.accountProfile.avatar = ''
      this.profile.jobIntention.intentionCityName = ''
      this.profile.jobIntention.intentionCityCode = ''
      this.profile.jobIntention.intentionProvinceName = ''
      this.profile.jobIntention.intentionProvinceCode = ''
      this.salaryMaxList = [{ value: 0, label: '面议' }]
      this.profile.jobIntention.salaryMax = 0
      this.profile.jobIntention.salaryMin = 0
      this.profile.accountProfile.isPublic = '1'
      this.profile.shields = []
      this.$nextTick(() => {
        this.$refs['form'].resetFields()
      })
      this.get_Level_List()
      this.checkTeacherMode()
      this.get_Province_List()
      this.get_Arrive_Time_List()
      this.get_Welfare_List()
      this.getEducationList()
      this.getJobStatus()
      this.getIntentionTotalPositionList()
      this.getSubjectPositionList()
    },
    // 移除照片
    remove_Upload_imageList(file, fileList) {
      this.profile.accountProfile.avatar = 'http://ossdev0.jiabala.com/bduHjrswEDdFO'
      this.imgsList = [{ url: 'http://ossdev0.jiabala.com/bduHjrswEDdFO' }]
      this.hideUpload = false
    },
    // 上传照片
    add_Upload_imageList(file, fileList) {
      this.imgFile = fileList.length > 0 ? file : null
      this.hideUpload = fileList.length >= 1
      if (this.imgFile !== null) {
        this.uploadImgToOss(this.imgFile).then((res) => {
          console.log(res)
          this.profile.accountProfile.avatar = res
          this.hideUpload = true
          this.imgsList = [{ url: res }]
        })
      }
    },
    // 是否已经添加老师检验
    checkTeacher(phone) {
      return new Promise((resolve, reject) => {
        power.checkTeacherPhoneDouble({ phone }).then((res) => {
          resolve(res.data)
        })
      })
    },
    // 屏蔽公司
    querySearch(queryString, cb) {
      power.getCompany({ keyword: queryString }).then((res) => {
        const restaurants = res.data
        const chooseCompany = restaurants.filter((item) => {
          return item.name.indexOf(queryString) !== -1
        })
        const results = []
        chooseCompany.forEach((item) => {
          const obj = {
            value: item.name,
            businessId: item.id,
            businessName: item.name,
            businessLogo: item.logoImg
          }
          results.push(obj)
        })
        cb(results)
      })
    },
    // 选择屏蔽公司
    selectShieldCompany(item) {
      if (this.handleResume === '添加老师') {
        if (
          this.blackCompanyList.length > 2 &&
          this.profile.shields.length > 2
        ) {
          this.$message.error('最多屏蔽三个公司')
        } else {
          const deleteValue = item
          delete deleteValue.value
          this.saveCompany.push(deleteValue)
          console.log(this.saveCompany)
          this.profile.shields = JSON.parse(JSON.stringify(this.saveCompany))
        }
      } else {
        if (
          this.blackCompanyList.length > 2 &&
          this.profile.shields.length > 2
        ) {
          this.$message.error('最多屏蔽三个公司')
        } else {
          const deleteValue = item
          delete deleteValue.value
          this.saveCompany.push(deleteValue)
          this.profile.shields = JSON.parse(JSON.stringify(this.saveCompany))
        }
      }
    },
    // 添加屏蔽公司
    comfirm_Shield_Company() {
      console.log(this.profile.shields)
      if (this.shieldCompanyName === '') {
        this.$message.error('请填写屏蔽公司')
      } else {
        if (
          this.blackCompanyList.length >= 3 &&
          this.profile.shields.length >= 3
        ) {
          this.$message.error('最多屏蔽三个公司')
        } else {
          this.blackCompanyList.push(this.shieldCompanyName)
          this.shieldCompanyName = ''
        }
      }
    },
    // 屏蔽公司tag
    removeBlackCompany(index) {
      if (this.handleResume === '编辑老师' && this.profile.shields.length > 0) {
        this.profile.shields.forEach(() => {
          this.profile.shields[index]['isDel'] = 1
        })
        this.blackCompanyList.splice(index, 1)
      } else if (this.handleResume === '添加老师') {
        this.blackCompanyList.splice(index, 1)
        this.saveCompany.splice(index, 1)
        this.profile.shields = JSON.parse(JSON.stringify(this.saveCompany))
      }
    },
    // 添加教育经历
    add_Education_Experience() {
      this.education_Title = '添加教育经历'
      this.addEducationExperienceDialog = true
      for (const key in this.EducationExperience) {
        this.EducationExperience[key] = ''
      }
      this.$nextTick(() => {
        this.$refs['EducationExperience'].clearValidate()
      })
    },
    // 删除学历
    delete_Education_Experience(index) {
      if (this.handleResume === '编辑老师') {
        this.profile.experiences.forEach((item) => {
          if (item.isDel === undefined) {
            this.confirmDialog('教育经历', this.profile.experiences, index)
          }
        })
        this.profile.experiences.splice(index, 1)
        this.delExperrience.forEach(() => {
          this.delExperrience[index]['isDel'] = 1
        })
      } else {
        this.confirmDialog('教育经历', this.profile.experiences, index)
      }
    },
    // 编辑学历
    edit_Education_Experience(item, index) {
      this.expId = item.id
      const config = {
        schoolName: item.schoolName,
        educationId: item.educationId,
        educationName: item.educationName,
        admissionTime: item.admissionTime,
        graduationTime: item.graduationTime,
        majorName: item.majorName,
        majorType: item.majorType + '',
        isFullTime: item.isFullTime + ''
      }
      this.copy_Education_Experience = JSON.parse(JSON.stringify(config))
      this.EducationExperience = this.copy_Education_Experience
      this.eduIndex = index
      this.education_Title = '编辑教育经历'
      this.addEducationExperienceDialog = true
    },
    // 教育经历
    EducationExperienceSubmit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const config = {
            schoolName: this.EducationExperience.schoolName,
            educationId: this.EducationExperience.educationId,
            educationName: this.EducationExperience.educationName,
            admissionTime: this.EducationExperience.admissionTime,
            graduationTime: this.EducationExperience.graduationTime,
            majorName: this.EducationExperience.majorName,
            majorType: this.EducationExperience.majorType,
            isFullTime: this.EducationExperience.isFullTime
          }
          if (config.graduationTime <= config.admissionTime) return this.$message.error('入学时间要小于毕业时间')
          if (this.education_Title === '添加教育经历') {
            this.copyEductionExpe = JSON.parse(JSON.stringify(config))
            this.profile.experiences.push(this.copyEductionExpe)
            this.delExperrience = this.profile.experiences
          } else {
            const config = {
              id: this.expId,
              isDel: 0,
              schoolName: this.EducationExperience.schoolName,
              educationId: this.EducationExperience.educationId,
              educationName: this.EducationExperience.educationName,
              admissionTime: this.EducationExperience.admissionTime,
              graduationTime: this.EducationExperience.graduationTime,
              majorName: this.EducationExperience.majorName,
              majorType: this.EducationExperience.majorType,
              isFullTime: this.EducationExperience.isFullTime
            }
            this.copyEductionExpe[this.eduIndex] = config
            this.profile.experiences[this.eduIndex] = config
            this.delExperrience = this.profile.experiences
            this.$message.success('编辑成功')
          }
          this.addEducationExperienceDialog = false
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    // 添加工作经历
    add_Works_Experience() {
      this.addWorkExperienceDialog = true
      this.work_Title = '添加工作经历'
      for (const key in this.WorkExperience) {
        this.WorkExperience[key] = ''
      }
      this.$nextTick(() => {
        this.$refs['WorkExperience'].clearValidate()
      })
    },
    // 工作经历
    WorkExperienceSubmit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const config = {
            businessName: this.WorkExperience.businessName,
            entryTime: this.WorkExperience.entryTime,
            quitTime: this.WorkExperience.quitTime,
            positionName: this.WorkExperience.positionName,
            workDescribe: this.WorkExperience.workDescribe
          }
          if (config.quitTime <= config.entryTime) return this.$message.error('入职时间要小于离职时间')
          if (this.work_Title === '添加工作经历') {
            this.copyWorkExpe = JSON.parse(JSON.stringify(config))
            this.profile.works.push(this.copyWorkExpe)
            console.log(this.profile.works)
            this.profile.works.map((item) => {
              item.workDescribe = item.workDescribe.replace(/\n/g, '<br />')
              item.workDescribe = item.workDescribe.replace(/<p>/g, '')
              item.workDescribe = item.workDescribe.replace(/<\/p>/g, '')
            })
            this.delWorks = this.profile.works
          } else {
            const config = {
              id: this.worksId,
              isDel: 0,
              businessName: this.WorkExperience.businessName,
              entryTime: this.WorkExperience.entryTime,
              quitTime: this.WorkExperience.quitTime,
              positionName: this.WorkExperience.positionName,
              workDescribe: this.WorkExperience.workDescribe
            }
            this.copyWorkExpe[this.workIndex] = config
            this.profile.works[this.workIndex] = config
            this.profile.works.forEach((item) => {
              item.workDescribe = item.workDescribe.replace(/\n/g, '<br />')
              item.workDescribe = item.workDescribe.replace(/<p>/g, '')
              item.workDescribe = item.workDescribe.replace(/<\/p>/g, '')
              item.workDescribe = item.workDescribe.replace(/<br \/>/g, '<br />')
            })
            this.delWorks = this.profile.works
            this.$message.success('编辑成功')
          }
          this.addWorkExperienceDialog = false
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    // 编辑工作经历
    edit_Works_Experience(item, index) {
      this.worksId = item.id
      const config = {
        businessName: item.businessName,
        entryTime: item.entryTime,
        quitTime: item.quitTime,
        positionName: item.positionName,
        workDescribe: item.workDescribe
      }
      config.workDescribe = item.workDescribe.replace(/<br \/>/g, '\n')
      this.copyWorkObj = JSON.parse(JSON.stringify(config))
      this.WorkExperience = this.copyWorkObj
      this.EducationExperience = this.copy_Education_Experience
      this.workIndex = index
      this.addWorkExperienceDialog = true
      this.work_Title = '编辑工作经历'
    },
    // 删除工作经历
    delete_Works_Experience(index) {
      if (this.handleResume === '编辑老师') {
        this.profile.works.splice(index, 1)
        this.profile.works.forEach((item) => {
          if (item.isDel === undefined) {
            this.confirmDialog('工作经历', this.profile.works, index)
          }
        })
        this.delWorks.forEach(() => {
          this.delWorks[index]['isDel'] = 1
        })
      } else {
        this.confirmDialog('工作经历', this.profile.works, index)
      }
    },
    // 选取职位意向
    select_Jobs_Intention(value) {
      this.profile.jobIntention.isRange = value[0]
      if (value[0] === 3) {
        this.profile.jobIntention.positionId = 0 + ''
        this.profile.jobIntention.positionName = '职业顾问'
        this.profile.jobIntention.positionChildId = ''
        this.profile.jobIntention.positionChildName = ''
      } else {
        this.profile.jobIntention.positionId = JSON.parse(value[1]).id
        this.profile.jobIntention.positionName = JSON.parse(value[1]).name
        this.profile.jobIntention.positionChildId = value.length === 2 ? '' : JSON.parse(value[2]).id
        this.profile.jobIntention.positionChildName = value.length === 2 ? '' : JSON.parse(value[2]).name
      }
    }
  }
}
</script>

<style scoped lang='scss'>
.content {
  padding: 10px;
  .header {
    margin-bottom: 15px;
    .searchBtn {
      margin-left: 15px;
    }
    .addTeachBtn {
      margin-left: 30px;
    }
    /deep/ .el-input__inner {
      width: 250px;
    }
  }
  .teacherHead {
    width: 90px;
  }
  .mainBox {
    display: flex;
    width: 100%;
    height: 450px;

    .main-left {
      flex: 1;
      border-right: 2px solid #1890ff;
      p {
        margin: 10px 0;
      }
      .basicInfo {
        width: 100%;
        display: flex;
        margin-bottom: 50px;
        .basic-left {
          width: 150px;
          margin-right: 15px;
          img {
            width: 100%;
          }
        }
      }
      .intention {
        ul {
          margin: 0;
          padding: 0;
          li {
            list-style: none;
            margin: 15px 0;
          }
        }
      }
    }
    .main-right {
      flex: 1;
      margin-left: 20px;
      overflow: auto;
      p {
        margin: 5px 0;
      }
      .education,
      .work {
        .educationexperience {
          margin: 30px 0;
        }
      }
    }
    .sameFont {
      font-size: 20px;
      font-weight: 700;
      color: #169bd5;
    }
    .exepress {
      font-size: 16px;
      font-weight: 700;
      &::before {
        content: "";
        display: block;
        width: 10px;
        height: 10px;
        background-color: #1890ff;
      }
    }
  }
  .xrequired:before {
    content: "* ";
    color: red;
    position: absolute;
    top: 15px;
    left: 15px;
  }
  /deep/ .el-form-item {
    position: relative;
  }
  // 添加教师
  .labelStyle {
    height: 50px;
    line-height: 50px;
    font-size: 18px;
    text-align: right;
  }
  .addBtn {
    margin-left: 50px;
  }
  .addTeacherForm {
    display: flex;
    .left {
      flex: 1;
      border-right: 2px solid #1890ff;
    }
    .right {
      flex: 1;
      margin-left: 20px;
    }
  }
  .showExpre {
    margin-left: 50px;
    margin-bottom: 20px;
    h3 {
      width: 100%;
      display: flex;
      align-items: center;
      margin: 0;
      span {
        font-size: 14px;
        font-weight: normal;
        margin-left: 10px;
      }
      .editBtn {
        margin-left: 25px;
      }
    }
    p {
      margin: 5px 0;
    }
    .retrun_html {
      p {
        margin: 0;
        padding: 0;
      }
    }
  }
  /deep/ .el-input {
    width: 80%;
  }
  /deep/ .el-form-item {
    margin-bottom: 20px;
  }
  /deep/ .el-dialog__body {
    padding: 20px;
  }
  /deep/ .salary {
    display: flex;
    justify-content: flex-start;
    span {
      margin-left: -30px;
      margin-right: 5px;
    }
  }
  .chooseCity {
    display: flex;
    .el-select--medium {
      width: 150px;
    }
  }
  .el-tag + .el-tag {
    margin-left: 10px;
  }
  .button_new_tag {
    margin-left: 10px;
    height: 32px;
    line-height: 30px;
    padding-top: 0;
    padding-bottom: 0;
  }
  .input-new-tag {
    width: 90px;
    margin-left: 10px;
    vertical-align: bottom;
  }
  .chooseAddressNow {
    /deep/ .el-select {
      width: 130px;
    }
  }
  // 隐藏添加框
  .hide /deep/.el-upload--picture-card {
    display: none;
    width: 100px;
    height: 100px;
  }
  /deep/ .el-autocomplete > .el-input {
    width: 300px;
  }
}
.headerForm {
  display: flex;
  margin-bottom: 15px;
  .el-input {
    width: 300px;
    margin-right: 15px;
  }
}
/deep/ .el-dialog__footer {
  padding: 0;
}
.pagination-container {
  margin-top: 0;
}
.organizationImgInfo {
  width: 50px;
}
/deep/ .el-table_2_column_12 .cell {
  font-size: 18px !important;
}
/deep/ .el-table_2_column_13 .cell {
  font-size: 18px !important;
}
/deep/ .el-table_2_column_14 .cell {
  font-size: 18px !important;
}
/deep/ .el-table_2_column_15 .cell {
  font-size: 18px !important;
}
</style>
